<?php
	include "../../public/commom/config.php";
	include "../lock2.php";
	
	$username = "";
	$password = "";
	$id = 0;
	
	if($_GET) {
		$id = $_GET["id"];
		
		$sql = "SELECT * FROM user WHERE id = $id";
		
		$result = mysqli_query($conn, $sql);
		
		while($row = mysqli_fetch_array($result)) {
			$username = $row["username"];
			$password = $row["password"];
			$area_id = $row["area_id"];
		}
	}
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
	</head>
	
	<body>
		<h1>修改用户</h1>
		<form class="form-inline" action="modify1.php" method="post">
			<label>用户名<input type="text" name="username" value="<?php echo $username; ?>" placeholder="请输入用户名..." autocomplete="off" /></label>
			<label>密码<input type="text" value="<?php echo $password; ?>" name="password" placeholder="请输入用户名..." autocomplete="off" /></label>
			<label>地区
				<select name="area_id">
					<?php
						$sql = "SELECT * FROM area";
							
						$result = mysqli_query($conn, $sql);
			
						while($row = mysqli_fetch_array($result)) {
							echo "<option value='" . $row["id"] . "'>" . $row["name"] . "</option>";
						}
						
						mysqli_close($conn);
					?>
				</select>
			</label>
			<input type="hidden" name="id" value="<?php echo $id; ?>" />
			<input type="submit" value="修改" />
		</form>
	</body>
	
</html>